/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package WS;
import BD.Modulos.BdTransportes;
import Interfaces.BdException;
import Objects.Log_TMarca;
import Objects.Log_TProced;
import Objects.Log_TTransp;
import Objects.Log_Vehiculos;
import java.sql.SQLException;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
/**
 *
 * @author armgarces
 */
@WebService(serviceName = "Transporte")
public class Transporte {
    public final static int CHECK_VEHICULO = 0;   
    public final static int CHECK_TMARCA   = 1;
    public final static int CHECK_TPROCED  = 2;
    public final static int CHECK_TTRANSP  = 3;
    @Resource
    WebServiceContext wsContext; 
    /***************************************************************************/
    /******************************* VEHICULOS *********************************/
    /***************************************************************************/
    /**
     * 
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "loadVehiculos")
    public synchronized Log_Vehiculos[] loadVehiculos() throws BdException {
        try{
            return (Log_Vehiculos[]) BdTransportes.getInstance().load(new Log_Vehiculos());
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param find
     * @return 
     * @throws Interfaces.BdException 
     */
    @WebMethod(operationName = "findVehiculos")
    public synchronized Log_Vehiculos[] findVehiculos(@WebParam(name = "find") String find) throws BdException {
        try{
            return (Log_Vehiculos[]) BdTransportes.getInstance().find(new Log_Vehiculos(), find);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param user
     * @param vehiculos
     * @param operacion
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "saveVehiculos")
    public synchronized boolean saveVehiculos(@WebParam(name = "user") String user, 
                                              @WebParam(name = "vehiculos")Log_Vehiculos vehiculos,
                                              @WebParam(name = "operacion") int operacion) throws BdException {
//        boolean boo = Validar.validar_Save_log_Vehiculos(log_vehiculos);
//        if (boo){
        try{                
            return BdTransportes.getInstance().saveVehiculos(user, operacion, vehiculos);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }       
        return false;
    }
    /**
     * 
     * @param name
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "checkVehiculos")
    public synchronized boolean checkVehiculos(@WebParam(name = "name") String name) throws BdException {
        try{
            return BdTransportes.getInstance().check(CHECK_VEHICULO, name);
        }catch(SQLException e){             
        }
        return false;
    }
    /**
     * 
     * @param user
     * @param vehiculos
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "changeVehiculos")
    public synchronized boolean changeVehiculos(@WebParam(name = "user") String user,
                                                @WebParam(name = "vehiculos")Log_Vehiculos vehiculos) throws BdException {
        try{
            return BdTransportes.getInstance().change(user,vehiculos);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }       
        return false;
    }        
    /***************************************************************************/
    /******************************** TMarca ***********************************/
    /***************************************************************************/
    /**
     * 
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "loadTMarca")
    public synchronized Log_TMarca[] loadTMarca() throws BdException {
        try{
            return (Log_TMarca[]) BdTransportes.getInstance().load(new Log_TMarca());      
            }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param find
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "findTMarca")
    public synchronized Log_TMarca[] findTMarca(@WebParam(name = "find") String find) throws BdException {
        try{
            return (Log_TMarca[]) BdTransportes.getInstance().find(new Log_TMarca(),find);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }    
    /**
     * 
     * @param user
     * @param tmarca
     * @param operacion
     * @return 
     * @throws Interfaces.BdException 
     */
    @WebMethod(operationName = "saveTMarca")
    public synchronized boolean saveTMarca(@WebParam(name = "user") String user, 
                                           @WebParam(name = "tmarca") Log_TMarca tmarca,
                                           @WebParam(name = "operacion") int operacion) throws BdException {
//        boolean boo = Validar.validar_Save_log_TMarca(log_tmarca);
//        if (boo){
        try{                
            return BdTransportes.getInstance().saveTMarca(user,operacion,tmarca);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }       
        return false;
    }
    /**
     * 
     * @param name
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "checkTMarca")
    public synchronized boolean checkTMarca(@WebParam(name = "name") String name) throws BdException {
        try{
            return BdTransportes.getInstance().check(CHECK_TMARCA,name);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }       
        return false;
    }
    /**
     * 
     * @param user
     * @param tmarca
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "changeTMarca")
    public synchronized boolean changeTMarca(@WebParam(name = "user") String user,
                                             @WebParam(name = "tmarca")Log_TMarca tmarca) throws BdException {
        try{
            return BdTransportes.getInstance().change(user,tmarca);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }       
        return false;
    }       
    /***************************************************************************/
    /********************************** TProced ********************************/
    /***************************************************************************/
    /**
     * 
     * @return 
     * @throws Interfaces.BdException 
     */
    @WebMethod(operationName = "loadTProced")
    public synchronized Log_TProced[] loadTProced() throws BdException {
        try{
            return (Log_TProced[]) BdTransportes.getInstance().load(new Log_TProced());      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }     
    /**
     * 
     * @param find
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "findTProced")
    public synchronized Log_TProced[] findTProced(@WebParam(name = "find") String find) throws BdException {
        try{
            return (Log_TProced[]) BdTransportes.getInstance().find(new Log_TProced(),find);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }  
    /**
     * 
     * @param user
     * @param tproced
     * @param operacion
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "saveTProced")
    public synchronized boolean saveTProced(@WebParam(name = "user") String user, 
                                            @WebParam(name = "tproced")Log_TProced tproced,
                                            @WebParam(name = "operacion")int operacion) throws BdException {
//        boolean boo = Validar.validar_Save_log_TProced(log_tproced);
//        if (boo){
        try{                
            return BdTransportes.getInstance().saveTProced(user,operacion,tproced);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }
    /**
     * 
     * @param name
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "checkTProced")
    public synchronized boolean checkTProced(@WebParam(name = "name") String name) throws BdException {
        try{
            return BdTransportes.getInstance().check(CHECK_TPROCED,name);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }
    /**
     * 
     * @param user
     * @param tproced
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "changeTProced")
    public synchronized boolean changeTProced(@WebParam(name = "user") String user, 
                                              @WebParam(name = "tproced") Log_TProced tproced) throws BdException {
        try{
            return BdTransportes.getInstance().change(user,tproced);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }  
    /***************************************************************************/
    /********************************** TTransp ********************************/
    /***************************************************************************/
    /**
     * 
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "loadTTransp")
    public synchronized Log_TTransp[] loadTTransp() throws BdException {
        try{
            return (Log_TTransp[]) BdTransportes.getInstance().load(new Log_TTransp());      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }        
    /**
     * 
     * @param find
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "findTTransp")
    public synchronized Log_TTransp[] findTTransp(@WebParam(name = "find") String find) throws BdException {
        try{
            return (Log_TTransp[]) BdTransportes.getInstance().find(new Log_TTransp(),find);      
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return null;
    }
    
    @WebMethod(operationName = "saveTTransp")
    public synchronized boolean saveTTransp(@WebParam(name = "user") String user,
                                            @WebParam(name = "ttransp")Log_TTransp ttransp,
                                            @WebParam(name = "operacion")int operacion) throws BdException {
//        boolean boo = Validar.validar_Save_log_TTransp(log_ttransp);
//        if (boo){
        try{                
            return BdTransportes.getInstance().saveTTransp(user,operacion,ttransp);
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }  
    /**
     * 
     * @param name
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "checkTTransp")
    public synchronized boolean checkTTransp(@WebParam(name = "name") String name) throws BdException {
        try{
            return BdTransportes.getInstance().check(CHECK_TTRANSP,name);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    } 
    /**
     * 
     * @param user
     * @param ttransp
     * @return
     * @throws BdException 
     */
    @WebMethod(operationName = "changeTTransp")
    public synchronized boolean changeTTransp(@WebParam(name = "user") String user,
                                              @WebParam(name = "ttransp")Log_TTransp ttransp) throws BdException {
        try{
            return BdTransportes.getInstance().change(user,ttransp);                
        }catch(BdException bde){
            throw bde;
        } catch (SQLException ex) {
        }
        return false;
    }       
}
